home *** CD-ROM | disk | FTP | other *** search
/ SunSoft Catalyst CDWARE 1996 May to August / Catalyst CDWARE 1996 May to August.iso / .products / .bin / httpd / Solaris_1 / acroread < prev    next >
Text File  |  1996-02-29  |  5KB  |  249 lines

  1. #!/bin/sh
  2. #
  3. # vi:set ts=40 sw=2:
  4. #
  5.  
  6. cat /tmp/httpd/.products/gui/AcroRead_lic.txt
  7.  
  8. cmd=acroread
  9. prod="Acrobat Reader"
  10. ver=2.1
  11. install_dir=/cdware/CDware/.products/.bin/httpd/Solaris_1
  12.  
  13. #
  14. # Prepend a colon seperated environment variable
  15. # $1 string to be prepended
  16. # $2 environment variable
  17. #
  18. prepend()
  19. {
  20.   if [ -z "$2" -o "$2" = "$1" ] ; then
  21.     echo "$1"
  22.   else
  23.     first="`expr "$2" : '\([^:]*\):'`"
  24.     if [ "$first" = "$1" ] ; then
  25.       echo "$2"
  26.     else
  27.       echo "${1}:${2}"
  28.     fi
  29.   fi
  30. }
  31.  
  32.  
  33. #
  34. # Tests the version file in an installation directory.
  35. #
  36. test_install_dir()
  37. {
  38.   if [ "$1" -a -f "$1/AcroVersion" ] \
  39.   && [ "`cat $1/AcroVersion 2>/dev/null`" = "$ver" ] ; then
  40.     return 0
  41.   else
  42.     return 1
  43.   fi
  44. }
  45.  
  46.  
  47. #
  48. # Get the current working directory.
  49. # Try to avoid automounter directories by checking
  50. # if $HOME or $PWD is the same directory as pwd,
  51. # and removing the automount directory component.
  52. #
  53. cwd="`pwd 2> /dev/null`"
  54. if [ -z "$cwd" -o ! -d "$cwd" ] ; then
  55.   echo "ERROR: Cannot determine current directory."
  56.   exit 1
  57. fi
  58.  
  59. if [ "$HOME" -a -d "$HOME" ] && [ "`cd / ; cd "$HOME" ; pwd`" = "$cwd" ] ; then
  60.   cwd="$HOME"
  61. elif [ "$PWD" -a -d "$PWD" ] && [ "`cd / ; cd "$PWD" ; pwd`" = "$cwd" ] ; then
  62.   cwd="$PWD"
  63. fi
  64.  
  65. if [ "$cwd" != / -a "${AUTOMOUNT_DIR=/tmp_mnt}" ] ; then
  66.   tmp="`expr "$cwd" : "$AUTOMOUNT_DIR"'\(.*\)'`"
  67.   if [ "$tmp" -a -d "$tmp" ] ; then
  68.     if [ "`cd / ; cd "$tmp" ; pwd`" = "`pwd`" ] ; then
  69.       cwd="$tmp"
  70.     fi
  71.   fi
  72. fi
  73.  
  74. PWD="$cwd"
  75. export PWD
  76.  
  77.  
  78. #
  79. # Setup ACRO_ARG0 to this script
  80. #
  81. arg0="$0"
  82. if [ "$arg0" ] ; then
  83.   case "$arg0" in
  84.      /*) ;;
  85.     ./*) arg0="$cwd/`expr "$arg0" : '\./\(.*\)'`" ;;
  86.       *) arg0="$cwd/$arg0" ;;
  87.   esac
  88.  
  89.   ACRO_ARG0="$arg0"
  90.   export ACRO_ARG0
  91. fi
  92.  
  93.  
  94. #
  95. # Try to find the installation directory
  96. #
  97. if ( test_install_dir "$install_dir" ) ; then
  98.   ACRO_INSTALL_DIR="$install_dir"
  99.   export ACRO_INSTALL_DIR
  100. else
  101.   script="$arg0"
  102.   while [ "$script" ] ; do
  103.     install_dir="`dirname "$script"`"
  104.     if ( test_install_dir "$install_dir" ) ; then
  105.       ACRO_INSTALL_DIR="$install_dir"
  106.       export ACRO_INSTALL_DIR
  107.       break
  108.     fi
  109.  
  110.     install_dir="`dirname "$install_dir"`"
  111.     if ( test_install_dir "$install_dir" ) ; then
  112.       ACRO_INSTALL_DIR="$install_dir"
  113.       export ACRO_INSTALL_DIR
  114.       break
  115.     fi
  116.  
  117.     if [ -h "$script" ] ; then
  118.       new_script=`ls -l "$script" | sed 's/^.*-> *\(.*\) *$/\1/'`
  119.       if [ "$new_script" -a "`expr "$new_script" : '/.*'`" = 0 ] ; then
  120.         new_script="`dirname "$script"`/$new_script"
  121.       fi
  122.       script="$new_script"
  123.     else
  124.       break
  125.     fi
  126.   done
  127.  
  128.   if ( test_install_dir "$ACRO_INSTALL_DIR" ) ; then
  129.     :
  130.   elif ( test_install_dir "$ACRO_HOME" ) ; then
  131.     ACRO_INSTALL_DIR="$ACRO_HOME"
  132.     export ACRO_INSTALL_DIR
  133.   else
  134.     echo "ERROR: Cannot find installation directory."
  135.     exit 1
  136.   fi
  137. fi
  138.  
  139.  
  140. #
  141. # setup the configuration from uname
  142. #
  143. os_name=`uname -s`
  144. os_release=`uname -r`
  145.  
  146. case "$os_name" in
  147.   SunOS)
  148.     case "$os_release" in
  149.       4.1.3*|4.1.4*)
  150.         ACRO_CONFIG=sparcsun
  151.         export ACRO_CONFIG
  152.         ;;
  153.       5.*)
  154.         ACRO_CONFIG=sparcsolaris
  155.         export ACRO_CONFIG
  156.         ;;
  157.     esac
  158.     ;;
  159.   HP-UX)
  160.     ACRO_CONFIG=hppahpux
  161.     export ACRO_CONFIG
  162.     ;;
  163. esac
  164.  
  165. if [ -z "$ACRO_CONFIG" ] ; then
  166.   echo "The OS named $os_name version $os_release is currently not supported."
  167.   echo "Try running on a supported platform and connecting to your display."
  168.   echo "Supported platforms include the following:"
  169.   echo "  SPARC/SunOS version 4.1.3 or 4.1.4"
  170.   echo "  SPARC/Solaris version 2.x"
  171.   echo "  HP/HP-UX version 9.0.x and 10.x"
  172.   exit 1
  173. fi
  174.  
  175.  
  176. #
  177. # XXX No LANG
  178. #
  179.  
  180.  
  181. #
  182. # Setup XKEYSYMDB
  183. #
  184. if [ -z "$XKEYSYMDB" -o ! -f "$XKEYSYMDB" ] ; then
  185.   if [ -f "$ACRO_INSTALL_DIR/$ACRO_CONFIG/lib/XKeysymDB" ] ; then
  186.     XKEYSYMDB="$ACRO_INSTALL_DIR/$ACRO_CONFIG/lib/XKeysymDB"
  187.     export XKEYSYMDB
  188.   elif [ -f "$ACRO_INSTALL_DIR/XKeysymDB" ] ; then
  189.     XKEYSYMDB="$ACRO_INSTALL_DIR/XKeysymDB"
  190.     export XKEYSYMDB
  191.   fi
  192. fi
  193.  
  194.  
  195. #
  196. # Prepend XFILESEARCHPATH
  197. #
  198. XFILESEARCHPATH="`prepend "$ACRO_INSTALL_DIR/$ACRO_CONFIG/%T/%N%S" "$XFILESEARCHPATH"`"
  199. export XFILESEARCHPATH
  200.  
  201.  
  202. #
  203. # Setup configuration specific environment variables
  204. #
  205. case "$ACRO_CONFIG" in
  206.   sparcsun)
  207.     LD_LIBRARY_PATH="`prepend "$ACRO_INSTALL_DIR/$ACRO_CONFIG/lib" "$LD_LIBRARY_PATH"`"
  208.     export LD_LIBRARY_PATH
  209.     XNLSPATH="$ACRO_INSTALL_DIR/$ACRO_CONFIG/lib/nls"
  210.     export XNLSPATH
  211.     ;;
  212.   sparcsolaris)
  213.     LD_LIBRARY_PATH="`prepend "$ACRO_INSTALL_DIR/$ACRO_CONFIG/lib" "$LD_LIBRARY_PATH"`"
  214.     export LD_LIBRARY_PATH
  215.     if [ -z "$LC_CTYPE" ] ; then
  216.       LC_CTYPE="iso_8859_1"
  217.       export LC_CTYPE
  218.     fi
  219.     ;;
  220.   hppahpux)
  221.     SHLIB_PATH="`prepend "$ACRO_INSTALL_DIR/$ACRO_CONFIG/lib" "$SHLIB_PATH"`"
  222.     export SHLIB_PATH
  223.     ;;
  224. esac
  225.  
  226.  
  227. #
  228. # Set the command.  Process any debug flags and exec.
  229. #
  230. ACRO_EXEC_CMD="$ACRO_INSTALL_DIR/$ACRO_CONFIG/bin/$cmd"
  231.  
  232. if [ "$1" = "-DEBUG" ] ; then
  233.   if [ $# = 1 ] ; then
  234.     export ACRO_EXEC_CMD
  235.     exec "$SHELL"
  236.   else
  237.     shift
  238.     exec ${1+"$@"} "$ACRO_EXEC_CMD"
  239.   fi
  240. fi
  241.  
  242. if [ -f "$ACRO_EXEC_CMD" ] ; then
  243.   exec "$ACRO_EXEC_CMD" ${1+"$@"}
  244. else
  245.   echo "ERROR: $prod not installed for this configuration, \"$ACRO_CONFIG\"."
  246.   exit 1
  247. fi
  248.  
  249.